<div class="form-container">
<div class="validation-errors" id="validationErrors" style="display:none;"></div>
<div class="walk-register-buttons" style="float: right;">
	<a href="<?php echo( base_url() ); ?>cmb/member/homepage_logout/"><img src="<?php echo( base_url() ); ?>assets/images/buttons/logout1.gif" border="0" /></a>
</div>
<?php
	Includes::IncludeFile( Includes::$FORM );
	Includes::IncludeFile( Includes::$SPACER );
			
		echo( form_open(base_url() . 'cmb/member_reports/registered_households_report/' .$urlKey.'/', array('id' => 'registeredHouseholdsForm') ) );

		//Collect search parameters for Registered Households Report
		//----------------------------------------
		Spacer::Render(0, 50);
		
		Form::OpenFormItem('Member Last Name : </br><font size="2" color="red">(type the first few letters to match)</font>', 300);
			echo( form_input(array('name'=>'memberlastname','id'=>'memberlastname','style'=>'width: 250px;')) );
		Form::CloseFormItem();
		Spacer::Render(0, 5);
													
		Form::OpenFormItem('Member First Name: </br><font size="2" color="red">(type the first few letters to match)</font>', 300);
			echo( form_input(array('name'=>'memberfirstname','id'=>'memberfirstname','style'=>'width: 250px;')) );
		Form::CloseFormItem();
		Spacer::Render(0, 5);

		Form::OpenFormItem('Member City: </br><font size="2" color="red">(type the first few letters to match)</font>', 300);
			echo( form_input(array('name'=>'membercity','id'=>'membercity','style'=>'width: 250px;')) );
		Form::CloseFormItem();
		Spacer::Render(0, 5);

		Form::OpenFormItem('Member State:', 300);
			$stateOptions = array('All'=>'All','AL'=>'Alabama','AK'=>'Alaska','AZ'=>'Arizona','AR'=>'Arkansas','CA'=>'California','CO'=>'Colorado','CT'=>'Connecticut','DE'=>'Delaware','DC'=>'District of Columbia','FL'=>'Florida','GA'=>'Georgia','HI'=>'Hawaii','ID'=>'Idaho','IL'=>'Illinois','IN'=>'Indiana','IA'=>'Iowa','KS'=>'Kansas','KY'=>'Kentucky','LA'=>'Louisiana','ME'=>'Maine','MD'=>'Maryland','MA'=>'Massachusetts','MI'=>'Michigan','MN'=>'Minnesota','MS'=>'Mississippi','MO'=>'Missouri','MT'=>'Montana','NE'=>'Nebraska','NV'=>'Nevada','NH'=>'New Hampshire','NJ'=>'New Jersey','NM'=>'New Mexico','NY'=>'New York','NC'=>'North Carolina','ND'=>'North Dakota','OH'=>'Ohio','OK'=>'Oklahoma','OR'=>'Oregon','PA'=>'Pennsylvania','RI'=>'Rhode Island','SC'=>'South Carolina','SD'=>'South Dakota','TN'=>'Tennessee','TX'=>'Texas','UT'=>'Utah','VT'=>'Vermont','VA'=>'Virginia','WA'=>'Washington','WV'=>'West Virginia','WI'=>'Wisconsin','WY'=>'Wyoming');
			echo( form_dropdown('memberstate', $stateOptions, '', 'id="memberstate" style="width: 120px;" ') );
		Form::CloseFormItem();

		Form::OpenFormItem('Member Center:', 300);
			$centerOptions = array('All'=>'All','Andover'=>'Andover', 'MetroWest'=>'MetroWest');
			echo( form_dropdown('centername', $centerOptions, 'All', 'id="centername" style="width: 100px;" ') );
		Form::CloseFormItem();

		Form::OpenFormItem('Member Type:', 300);
			$payOptions = array('All'=>'All','Regular'=>'Regular', 'Life'=>'Life');
			echo( form_dropdown('memtype', $payOptions, 'All', 'id="memtype" style="width: 100px;" ') );
		Form::CloseFormItem();

		Form::OpenFormItem('Member Payment Type:', 300);
			$payOptions = array('All'=>'All','Online'=>'Online', 'Check'=>'Check', 'None'=>'None');
			echo( form_dropdown('paytype', $payOptions, 'All', 'id="paytype" style="width: 100px;" ') );
		Form::CloseFormItem();

		Form::OpenFormItem('Member Payment Status:', 300);
			$payOptions = array('All'=>'All','Paid'=>'Paid', 'NotPaid'=>'Not Paid');
			echo( form_dropdown('paid', $payOptions, 'All', 'id="paid" style="width: 100px;" ') );
		Form::CloseFormItem();

		echo( form_close() );
?>
	<div class="form-button-container">
		<a href="javascript: validate();"><img src="<?php echo( base_url() );?>assets/images/buttons/submit_off1.gif" border="0" onmouseover="this.src = '<?php echo( base_url() );?>assets/images/buttons/submit_over1.gif';" onmousedown="this.src = '<?php echo( base_url() );?>assets/images/buttons/submit_on1.gif';" onmouseup="this.src = '<?php echo( base_url() );?>assets/images/buttons/submit_off1.gif';" onmouseout="this.src = '<?php echo( base_url() );?>assets/images/buttons/submit_off1.gif';" />
	</div>	

</div>

<script type="text/javascript">
	function validate()
	{
		new Ajax.Request(baseUrl + 'validation/reports_validation/validate_registered_households/', 
		{
			method:'post',
			parameters: Form.serialize( $('registeredHouseholdsForm') ),
		  	onSuccess: function(response)
			{
				var result = response.responseText;
				
				if( result == 'VALIDATION_SUCCESS' )
				{
					$('registeredHouseholdsForm').submit();
				}
				else
				{
					$('validationErrors').innerHTML = result;
					$('validationErrors').show();
					Effect.ScrollTo('validationErrors', { duration:'0.2', offset:-20 });
				}
			},
			onFailure: function(response){var result = response.responseText; $('validationErrors').innerHTML = result;
					$('validationErrors').show();alert('failed') }
		});
	}
</script>
